ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
PIT.h
Go to the documentation of this file.
00001 
00017 #ifndef _PIT_H
00018 #define _PIT_H
00019 
00020 /*
00021  **************************************************************
00022  * Defines, Macros and Typedefs 
00023  **************************************************************/
00024 /*** Constant Macros ***/
00025 /* Default Yes and No defines */
00026 #ifndef TRUE
00027  #define TRUE (1u)
00028 #endif
00029 #ifndef CLEAR
00030  #define CLEAR (0u)
00031 #endif
00032 #ifndef BITS_IN_NIBBLE
00033  #define BITS_IN_NIBBLE (4u)
00034 #endif
00035 #ifndef BITS_IN_BYTE
00036  #define BITS_IN_BYTE (8u)
00037 #endif
00038 #ifndef BYTES_IN_16
00039  #define BYTES_IN_16  (2u)
00040 #endif
00041 #ifndef BYTES_IN_32
00042  #define BYTES_IN_32  (4u)
00043 #endif
00044 #ifndef BIT_DEFINITION
00045  #define BIT_DEFINITION
00046  #define BIT0  (1u << 0u)
00047  #define BIT1  (1u << 1u)
00048  #define BIT2  (1u << 2u)
00049  #define BIT3  (1u << 3u)
00050  #define BIT4  (1u << 4u)
00051  #define BIT5  (1u << 5u)
00052  #define BIT6  (1u << 6u)
00053  #define BIT7  (1u << 7u)
00054  #define BIT8  (1u << 8u)
00055  #define BIT9  (1u << 9u)
00056  #define BIT10 (1u << 10)
00057  #define BIT11 (1u << 11)
00058  #define BIT12 (1u << 12)
00059  #define BIT13 (1u << 13)
00060  #define BIT14 (1u << 14)
00061  #define BIT15 (1u << 15)
00062  #define BIT16 (1u << 16)
00063  #define BIT17 (1u << 17)
00064  #define BIT18 (1u << 18)
00065  #define BIT19 (1u << 19)
00066  #define BIT20 (1u << 20)
00067  #define BIT21 (1u << 21)
00068  #define BIT22 (1u << 22)
00069  #define BIT23 (1u << 23)
00070  #define BIT24 (1u << 24)
00071  #define BIT25 (1u << 25)
00072  #define BIT26 (1u << 26)
00073  #define BIT27 (1u << 27)
00074  #define BIT28 (1u << 28)
00075  #define BIT29 (1u << 29)
00076  #define BIT30 (1u << 30)
00077  #define BIT31 (1u << 31)
00078 #endif
00079 
00080 #define N_PIT_CHANNELS (4u)
00081 
00082 /* Errors */
00084 #define PIT_INVALID_CH ((uint8_t)BIT0)
00085 
00086 #define PIT_ERROR_TIMED_OUT ((uint8_t)BIT1)
00087 
00088 /*** Function Macros ***/
00089 #ifndef N_ELEMENTS
00090  #define N_ELEMENTS(X)           (sizeof(X)/sizeof(*(X)))
00091 #endif
00092 
00093 #define PIT_CLEAR_FLAG(XX)       PIT.CH[XX].TFLG.R = TRUE
00094 
00095 
00096 /*** Enums ***/
00097 
00098 /*** TypeDefs ***/
00099 
00100 /*
00101  **************************************************************
00102  * Declarations 
00103  **************************************************************/
00104 /*** Extern ***/
00105 
00106 /*** Globals ***/
00107 
00108 /*** Static Globals ***/
00109 
00110 /*
00111  **************************************************************
00112  * Function Prototypes 
00113  **************************************************************/
00114 /*
00115  ******************************************************************************
00116  *
00117  * Function:          u8fnPITConfig()
00118  *
00119  */
00129 uint8_t u8fnPITConfig(const uint8_t u8Channel, 
00130                       const uint32_t u32InitialCount,
00131                       const uint8_t u8UseISR);
00132 /*
00133  ******************************************************************************
00134  *
00135  * Function:          vfnPITStart()
00136  *
00137  */
00145 void vfnPITStart(const uint8_t u8Channel, const uint8_t u8Enable);
00146 /*
00147  ******************************************************************************
00148  *
00149  * Function:          u8fnPITWaitByPoll()
00150  *
00151  */
00160 uint8_t u8fnPITWaitByPoll(const uint8_t u8Channel, const uint8_t u8Restart);
00161 #endif /* _FILENAME_H */